home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Games: Greatest Hits 1996
/
Amiga Games: Greatest Hits 1996.iso
/
rexx
/
savesprites.agaiff
< prev
next >
Wrap
Text File
|
1995-04-23
|
2KB
|
74 lines
/* SaveSprites.agaiff
*
* Saves as many 16 pixels wide sprites as needed to build up a sprite logo
* with the selected range width, that means if you want to display sprite
* gfx with 48 pixels width on the old chipset, you NORMALLY need to save
* 3 sprites on your own...
*/
lf = "a"X /* Linefeed character */
address "AGAIFF_REXX"
options results
SHOWGUI
if RC ~= 0 then exit
STATUS 0
if result = "" then do
TYPETEXT "No picture loaded..."
exit
end
/* Get picture data */
STATUS 3
parse var result RangeX1 RangeY1 RangeX2 RangeY2
STATUS 2
parse var result Depth
Height = RangeY2-RangeY1+1
Width = RangeX2-RangeX1+1
NumberOfSprites = (Width+15)%16
select
when Depth=2 then do
if NumberOfSprites>8 then do
TYPETEXT "Maximum range (2 planes) is 8 sprites (128 pixels)"
exit
end
end
when Depth=4 then do
if NumberOfSprites>4 then do
TYPETEXT "Maximum range (4 planes) is 4 sprites (64 pixels)"
exit
end
end
otherwise do
TYPETEXT "2 or 4 planes please !"
exit
end
end
SETPRESET "Sprite dc."
REQUEST "Save as assembler source (OK)" || lf || "or data file (CANCEL) ?"
if RC = 0 then SFORMAT FILE
REQUESTFILE "Save filename w/ suffix"
pathname = result
if pathname = "" then exit;
NOSHOW
rx1 = RangeX1
do i=0 for NumberOfSprites
RANGE rx1 RangeY1 rx1+15 RangeY2
SAVE pathname || "." || i
rx1 = rx1 + 16
end
RANGE RangeX1 RangeY1 RangeX2 RangeY2
RESHOW
SHOWGUI
TYPETEXT "Okidoki..."